import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    redirect: '/business/list'
  },
  {
    path: '/business/list',
    component: () => import('@/views/business/list')
  },
  {
    path: '/business/listSearched',
    component: () => import('@/views/business/listSearched')
  },
  {
    path: '/business/detail',
    component: () => import('@/views/business/detail/index'),
    redirect: '/business/detail/foods',
    children: [
      {
        path: 'foods',
        component: () => import('@/views/business/detail/foods')
      },
      {
        path: 'info',
        component: () => import('@/views/business/detail/info')
      }
    ]
  },
  {
    path: '/cart/list',
    component: () => import('@/views/cart/list')
  },
  {
    path: '/user/my',
    component: () => import('@/views/user/my'),
  },
  {
    path: '/user/myCanOut',
    component: () => import('@/views/user/myCanOut.vue')
  },
  {
    path: '/user/login',
    component: () => import('@/views/user/login')
  },
  {
    path: '/user/resisterLogin',
    component: () => import('@/views/user/registerLogin')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
